home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / dsniff / decode_imap.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-16  |  596 b   |  35 lines

  1. /*
  2.   decode_imap.c
  3.  
  4.   Internet Mail Access Protocol.
  5.   
  6.   Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  7.   
  8.   $Id: decode_imap.c,v 1.1 2000/05/16 17:31:14 dugsong Exp $
  9. */
  10.  
  11. #include <sys/types.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include "decode.h"
  15.  
  16. int
  17. decode_imap(u_char *buf, int len)
  18. {
  19.     char *p;
  20.     
  21.     Buf[0] = '\0';
  22.     
  23.     for (p = strtok(buf, "\r\n"); p != NULL; p = strtok(NULL, "\r\n")) {
  24.         if ((p = strchr(p, ' ')) != NULL) {
  25.             p++;
  26.             if (strncasecmp(p, "LOGIN ", 6) == 0) {
  27.                 strlcat(Buf, p, sizeof(Buf));
  28.                 strlcat(Buf, "\n", sizeof(Buf));
  29.             }
  30.         }
  31.     }
  32.     return (strlen(Buf));
  33. }
  34.  
  35.